package com.ls.netty.inboundoutboundhandler.client;

import com.ls.netty.inboundoutboundhandler.coder.MyByteToLongDecoder2;
import com.ls.netty.inboundoutboundhandler.coder.MyLongToByteEncoder;
import com.ls.netty.inboundoutboundhandler.coder.MyByteToLongDecoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

public class MyClientInitialiter extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        //加入一个出站hendler 对数据进行编码
        pipeline.addLast(new MyLongToByteEncoder());
        pipeline.addLast(new MyByteToLongDecoder2());
//        pipeline.addLast(new MyByteToLongDecoder());
        pipeline.addLast(new MyClientHandler());
    }
}
